﻿using System;
using System.Collections.Generic;
using Sustainalytics.Entities;
using Sustainalytics.Entities.ESGRatings;

namespace Sustainalytics.ESGRatings.Service
{

    public class Helper
    {
        public Guid Id { get; set; }
        public string Name { get; set; }
    }
    public class ESGProfileOutDto
    {
        public IEnumerable<Helper> ListReferenceUniverses { get; set; }
        public IEnumerable<Helper> ListMatrixes { get; set; }
        public IEnumerable<ESGProfileDto> Profiles { get; set; }
    }

    public class ESGProfileDto
    {

        public Guid Id { get; set; }

        public Guid? AccountId { get; set; }

        public AccessLevel AccountType { get; set; }

        public ActiveTypeEnum? Active { get; set; }

        public string Name { get; set; }

        public Guid MatrixId { get; set; }
        public string MatrixName { get; set; }

        public Guid ReferenceUniverseId { get; set; }
        public string ReferenceUniverseName { get; set; }

        public DateTime LastModifiedDate { get; set; }

        public TemplateTypeEnum TemplateType { get; set; }
        public CompanyTypeEnum CompanyType { get; set; }
        public ComparativeGroupEnum ComparativeGroup { get; set; }


        public static ESGProfileDto FromESGProfile(ESGProfile input)
        {

            return new ESGProfileDto
            {
                Id = input.Id,
                AccountId = input.AccountId,
                AccountType = input.AccountType,
                Active = input.Active,
                Name =  input.Name,
                MatrixId =  input.MatrixId ,
                MatrixName =  input.MatrixName ,
                ReferenceUniverseId =  input.ReferenceUniverseId ,
                ReferenceUniverseName = input.ReferenceUniverseName ,
                TemplateType =  input.TemplateType,
                CompanyType = input.CompanyType ,
                ComparativeGroup = input.ComparativeGroup,
                LastModifiedDate = input.LastModifiedDate
            };
        }

        public static ESGProfile ToESGProfile(ESGProfileDto input)
        {

            return new ESGProfile
            {
                Id = input.Id,
                AccountId = input.AccountId,
                AccountType = input.AccountType,
                Active = input.Active,
                Name = input.Name,
                MatrixId = input.MatrixId,
                MatrixName = input.MatrixName,
                ReferenceUniverseId = input.ReferenceUniverseId,
                ReferenceUniverseName = input.ReferenceUniverseName,
                TemplateType = input.TemplateType,
                CompanyType = input.CompanyType,
                ComparativeGroup = input.ComparativeGroup,
                LastModifiedDate = DateTime.UtcNow
            };
        }

    }
}
